import type { RouteRecordRaw } from 'vue-router';
/**
 * 路由meta对象参数说明
 * meta: {
 *      title:          菜单栏及 tagsView 栏、菜单搜索名称（国际化）
 *      hidden：        是否隐藏此路由
 *      icon：          菜单、tagsView 图标，阿里：加 `iconfont xxx`，fontawesome：加 `fa xxx`
 * }
 */

//静态路由（默认路由）
export const staticRoutes: Array<RouteRecordRaw> = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login/index.vue'),
    meta: {
      hidden: true
    }
  },

  {
    path: '/404',
    name: '404',
    component: () => import('@/views/error/404.vue'),
    meta: {
      hidden: true
    }
  },

  {
    path: '/',
    component: () => import('@/layout/index.vue'),
    redirect: '/home',
    children: [{
      path: 'home',
      name: 'Home',
      component: () => import('@/views/home/index.vue'),
      meta: {
        title: '首页',
        icon: 'ele-HomeFilled',
      }
    }]
  },

];

//动态路由
export const allAsyncRoutes: Array<RouteRecordRaw> = [
  //因为侧边栏的标题是遍历一级路由生成的，所以商品管理要写在一级路由
  {
    path: "/prodect",
    name: "Prodect",
    component: () => import('@/layout/index.vue'),
    meta: {
      title: "商品管理",
      icon: "ele-Star"
    },
    children: [
      {
        path: "/prodect/trademark",
        name: "Prodect",
        component: () => import('@/views/Product/Trademark/index.vue'),
        meta: {
          title: "品牌属性"
        }
      },
      {
        path: "/prodect/attr",
        name: "Attr",
        component: () => import('@/views/Product/Attr/index.vue'),
        meta: {
          title: "平台属性管理"
        }
      },
      {
        path: "/prodect/sku",
        name: "Sku",
        component: () => import('@/views/Product/Sku/index.vue'),
        meta: {
          title: "Sku"
        }
      },
      {
        path: "/prodect/spu",
        name: "Spu",
        component: () => import('@/views/Product/Spu/index.vue'),
        meta: {
          title: "Spu"
        }
      },
    ]
  },
];

//任意路由
export const anyRoutes: RouteRecordRaw = {
  path: '/:pathMatch(.*)',
  name: 'Any',
  redirect: '/404',
  meta: {
    hidden: true
  }
}
